
{extend name='public/window' /}

{block name="content"}
	<style type="text/css">
	.cardDetail{
	    margin: 35px 0 10px 0;
	    padding: 0 10px;
	}
	.banjies{
		color: #ffffff;
		font-size: 14px;
		background-color: #2d8cf0;
		padding: 3px;
		 width: 60px;
		 border-radius: 5px;
		 text-align: center;
		line-height: 24px;
		display: inline-block;
	}
	</style>
	<body>
		<div >
		    <div class="uni-card uni-border" class="uni-card--full uni-card--shadow">
		        <!-- 办结 -->
		        <div class="cardDetail">
		           <span>处理结果：</span>
		        </div>
				<textarea id="textarea" rows="3" cols="20" style=" margin: -28px 0 0 100px;resize: none;border-radius: 3px;height: 80px;width: 200px;border: #ccc solid 0.5px;color: #968e8e;">已处理完成</textarea>
                 <div style="width: 188px;height: 50px;margin: 20px 0 0 108px;"> <span class="banjies"lay-filter="refund" lay-submit style="float: left;">确定</span><span class="banjies" lay-submit lay-filter="exit" style="	float: right;">取消</span></div>
		    </div>
		</div>
	</body>
<script>
		layui.use(['element', 'table', 'form', 'jquery', 'lucky', 'opTable','layer'], function() {
			var element = layui.element;
			var form = layui.form;
			var table = layui.table;
			var $ = layui.jquery;
			var lucky = layui.lucky;
			var opTable = layui.opTable;
			var layer = layui.layer;
			form.render();
			console.log('进来了1')
			console.log('输入的处理结果：'+$("#textarea").val())
			form.on('submit(exit)', function(obj) {
			console.log('溜了溜了');
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
			});
		
			form.on('submit(refund)', function(obj) {
				console.log('进来了2')
				var test =window.location.href;
				var id=test.split("?id=")[1];
				var remark= $("#textarea").val()
				$.ajax({
					url: "{:url('end')}",
					type: "post",
					data: {
						id: id,
						remark: remark,
					},
					dataType: "json",
					success: function(data) {
						if (data.code == 1) {
							var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
							parent.layer.close(index); //再执行关闭 
							layer.msg(data.msg, {
								icon: 1,
								time: 1000
							});

						} else {
                             var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                             parent.layer.close(index); //再执行关闭 

						}
					}
				});
			});

		});
	</script>

{/block}